#include <cmath>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

typedef std::pair<float, float> PFF;

class BASEHACKLINE {
   public:
    BASEHACKLINE(std::vector<PFF>);
    BASEHACKLINE(int region[][2], int pointNums);
    int detectHack(PFF targetPoint, PFF targetPoint1);  // 判断是否入侵
    void showRegion(cv::Mat& image);                    // 将线显示在图像上
   private:
    std::vector<PFF> points;                                                                                   // 存储入侵线段点
    bool IsIntersect(float px1, float py1, float px2, float py2, float px3, float py3, float px4, float py4);  // 判断线段相交
};
